package ltd.dujiabao.alog.fib;


/**
 * @author : DuJiabao
 * @Project : sword-finger-offer
 * @Time : 2021/4/13 22:53
 * @Desc :
 */
public class Fib {
  public static int fib(int n) {
    int[] f = new int[n];
    f[0] = 0;
    f[1] = 1;
    for (int i = 2; i < n; i++) {
      f[i] = f[i - 1] + f[i - 2];
    }
    return f[n - 1];
  }

  public static void main(String[] args) {
    int fib = fib(2);
    System.out.println(fib);
  }
}
